12. Exercise 2: Solution

Heading

Exercise 2: Solution

ND320 C4 L4 10 AFib Detection Model

Summary

Summary

In the video, we go over how the features are computed from the input signal. NumPy operations help us compute the summary statistics easily. We can use NumPy boolean arrays to count the number of outliers and the percent of RR interval differences greater than 50ms. For the frequency domain features, we first resample our RR interval time series to a regular grid using linear interpolation.

Exercise 3: Atrial Fibrillation

After featurizing our signal, we need to classify these features. In the next exercise, you will do just this using any model that you are comfortable with. Feel free to use the same random forest model that we used for activity classification. Evaluate the performance of your classifier using cross validation.

Instructions

  1. Complete the Offline or Online instructions below.
  2. Read through the whole .ipynb.
  3. Complete all the code cells that contain ## Your Code Goes Here.

Offline

  1. In the repo which you can access here in the repo /ecg-processing/exercises/3-atrial-fibrillation/) you should find the following files:
  • 3_atrial_fibrillation.ipynb
  • l4e1/*.npz
  1. Open up the python notebook and associated files in your desired editor.

Note: Instructions can be found in Introduction to Wearable Data's Concept Developer Workflow for how to set up your local environment.

Online

  1. Go to the next concept and the 2_af_features.ipynb should be open and the workspace should already contain the appropriate data file, l4e1/*.npz.